package com.mentalhealthplatform.studentV3;

import com.mentalhealthplatform.appModels.Student;
import com.mentalhealthplatform.global.rbac.model.User;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.List;
import java.util.UUID;


/**
 * @author Pear
 */
public class CustomUserDetailsV3 implements UserDetails {
    private final Student student;

    public CustomUserDetailsV3(Student student) {
        this.student = student;
    }

    public UUID getStudentId() {
        return student.getId();
    }

    // 覆盖 UserDetails 接口的方法

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return List.of();
    }

    @Override
    public String getPassword() {
        return "";
    }

    @Override
    public String getUsername() {
        return student.getName();
    }

    public UUID getId() {
        return student.getId();
    }

    public User getUser() {
        return student;
    }

    // 其他方法 ...
}
